<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYqProductChannelTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('yq_product_channel')) {
            Schema::create('yq_product_channel', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('site_id')->default(0);
                $table->integer('product_id')->default(0)->comment('产品ID');
                $table->string('name')->default('')->comment('表单名称');
                $table->string('url')->default('')->comment('购买链接');
                $table->integer('created_at')->nullable();
                $table->integer('updated_at')->nullable();
                $table->integer('deleted_at')->nullable();
            });
            \Illuminate\Support\Facades\DB::statement("ALTER TABLE `" . app('db')->getTablePrefix() . "yq_product_channel` comment '产品--销售渠道表'");
        }
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('yq_product_channel');
    }

}
